Displays a dialog box containing a message and returns a value.
メッセージ表示用のダイアログボックスを表示して、値を返します。
MsgBox (Text As String [,Type As Integer [,Dialogtitle As String]])
MsgBox (Text As String [,Type As Integer [,Dialogtitle As String]])
Integer
整数
Text: String expression displayed as a message in the dialog box. Line breaks can be inserted with Chr$(13).
Text:ダイアログボックスにメッセージとして表示する文字列表式。表示メッセージを改行する場合は、該当箇所に Chr$(13) を挿入します。
DialogTitle: String expression displayed in the title bar of the dialog. If omitted, the name of the respective application is displayed.
DialogTitle:ダイアログボックスのタイトルバーに表示する文字列表式。これを省略した場合は、該当するアプリケーション名が表示されます。
Type: Any integer expression that specifies the dialog type and defines the number and type of buttons or icons displayed. Type represents a combination of bit patterns (dialog elements defined by adding the respective values):
Type:ダイアログ本体の種類および、ダイアログ上に表示するボタンの数と種類とアイコンを指定する整数表式。この Type の値は、ビットパターン (個々のダイアログ要素を示す値) を組み合わせて指定します。
Values
値
0 : Display OK button only.
0 : OK ボタンのみを表示させます。
1 : Display OK and Cancel buttons.
1 : OK およびキャンセルの各ボタンを表示させます。
2 : Display Abort, Retry, and Ignore buttons.
2 : 中止、やり直し、および取消しの各ボタンを表示させます。
3 : Display Yes, No, and Cancel buttons.
3 : はい、いいえ、キャンセルの各ボタンを表示させます。
4 : Display Yes and No buttons.
4 : はい、いいえの各ボタンを表示させます。
5 : Display Retry and Cancel buttons.
5 : やり直しおよびキャンセルの各ボタンを表示させます。
16 : Add the Stop icon to the dialog.
16 : ダイアログ上にストップ記号のアイコンを表示させます。
32 : Add the Question icon to the dialog.
32 : ダイアログ上に疑問符のアイコンを表示させます。
48 : Add the Exclamation Point icon to the dialog.
48 : ダイアログ上にエクスクラメーション記号のアイコンを表示させます。
64 : Add the Information icon to the dialog.
64 : ダイアログ上にインフォメーション記号のアイコンを表示させます。
128 : First button in the dialog as default button.
128 : ダイアログ上の 1 番目のボタンを、標準ボタンとします。
256 : Second button in the dialog as default button.
256 : ダイアログ上の 2 番目のボタンを、標準ボタンとします。
512 : Third button in the dialog as default button.
512 : ダイアログ上の 3 番目のボタンを、標準ボタンとします。
Return value:
戻り値:
1 : OK
1 : OK
2 : Cancel
2 : キャンセル
3 : Abort
3 : 中止
4 : Retry
4 : やり直し
5 : Ignore
5 : 無視 (する)
6 : Yes
6 : はい
7 : No
7 : いいえ
Sub ExampleMsgBox
Sub ExampleMsgBox
Dim sVar as Integer
Dim sVar as Integer
sVar = MsgBox("Las Vegas")
sVar = MsgBox("Las Vegas")
sVar = MsgBox("Las Vegas",1)
sVar = MsgBox("Las Vegas",1)
sVar = MsgBox( "Las Vegas",256 + 16 + 2,"Dialog title")
sVar = MsgBox( "Las Vegas",256 + 16 + 2,"Dialog title")
end sub
end sub